<?php

namespace App\Exports;

use App\Models\Resume;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithProperties;
use Maatwebsite\Excel\Facades\Excel;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;

class ResumeExport extends DefaultValueBinder implements FromQuery, WithHeadings , WithMapping ,WithCustomValueBinder
{
	use Exportable;
	
	

    public function query()
    {
    	return Resume::query();
    }
    
    public function headings(): array
    {
    	return [
    		'id',
		    '姓名',
		    '岗位名称',
		    '团队规模',
		    '是否有带团队潜力',
		    '是否有海外工作经历',
		    '海外工作年限',
		    '资质证书',
		    '所在行业_简历解析',
		    '友商经历',
		    '简历内容'
	    ];
    }

    public function map($resume): array
    {
	    $data = [
	    	$resume->mi_id,
		    $resume->name,
		    $resume->post,
		    $resume->scale,
		    $resume->has_team,
		    $resume->has_overseas_experience,
		    $resume->overseas_seniority,
		    $resume->certificate,
		    $resume->industry,
		     $resume->ys,
		    $resume->content,
	    ];
	    return $data;
    }
}
